﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class OrbCollect : MonoBehaviour
{
    private int player;
    public GameObject explosionVFXPrefab;

    private void Start()
    {
        player = LayerMask.NameToLayer("Player");

        GameManager.RegisterOrb(this);
    }

    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.layer == player)
        {
            Instantiate(explosionVFXPrefab,transform.position,transform.rotation);

            AudioManager.PlayOrbAudio();

            GameManager.PlayerCollectOrb(this);

            gameObject.SetActive(false);
        }
    }
}
